package weichuanbo.com.mywebserver.file;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import weichuanbo.com.mywebserver.R;

/**
 * Created by ssy on 2018/8/23 11:14
 * E-Mail ：1161209667@qq.com
 */
class FileAdapter extends BaseAdapter{

    private final List<SharedFile> fileLists;
    private final Context context;

    public FileAdapter(List<SharedFile> fileLists, Context context) {
        this.fileLists = fileLists;
        this.context = context;
    }

    @Override
    public int getCount() {
        return fileLists.size();
    }

    @Override
    public SharedFile getItem(int i) {
        return fileLists.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        View inflate = View.inflate(context, R.layout.file_item, null);
        TextView fileName = inflate.findViewById(R.id.tv_file_name);
        fileName.setText(fileLists.get(i).getPath());
        return null;
    }
}
